package cn.wolfcode.trip.base.domain;

import com.alibaba.druid.support.json.JSONUtils;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class Strategy extends BaseDomain {
    public static final int STATE_NORMAL = 0;
    public static final int STATE_STOP = -1;
    public static final int STATE_COMMEND = 1;
    private Region place;

    private String title;

    private String subTitle;

    private String coverUrl;

    private Integer state = STATE_NORMAL;

    public String getStateName(){
        String temp = "正常";
        if(state == STATE_STOP){
            temp = "禁用";
        }else if(state == STATE_COMMEND){
            temp = "推荐";
        }
        return temp;
    }
    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",getId());
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        if(place != null){
         map.put("placeId",place.getId());
        }
        map.put("state",state);
        return JSONUtils.toJSONString(map);
    }


}